/*******************************************************
* Copyright (c) 2018-2088, By XuXiang all rights reserved.
*
* FileName: NetMsgFight.h
* Summary: 战斗模块协议。
*
* Author: AutoBuild
* Date: --/--
*******************************************************/

#ifndef __NetMsgFight_h__
#define __NetMsgFight_h__

#include "../Macro.h"
#include "../Net/NetMessage.h"
#include "../Util/DataUtil.h"
#include <string>
#include <vector>
using namespace std;

namespace Competition
{
	namespace Net
	{
		//协议号
		namespace MsgID
		{
			const Int32 CS_FIGHT_STATE = 3001;					//战斗状态请求
			const Int32 CS_FIGHT_SELECT_ROLE = 3002;			//选择角色请求
			const Int32 CS_FIGHT_LOADING_PROGRESS = 3004;		//加载进度上报
			const Int32 CS_FIGHT_OPERATE = 3006;				//操作请求
			const Int32 CS_FIGHT_RESULT = 3007;					//结果请求
			const Int32 CS_FIGHT_QUIT = 3008;					//退出请求
			const Int32 CS_FIGHT_FRAME_RECORD = 3009;			//战斗帧记录请求
			const Int32 SC_FIGHT_STATE = 3401;					//战斗状态通知
			const Int32 SC_FIGHT_SELECT_ROLE = 3402;			//选择角色通知
			const Int32 SC_FIGHT_SELECT_ROLE_END = 3403;		//选择角色结束通知
			const Int32 SC_FIGHT_LOADING_PROGRESS = 3404;		//加载进度通知
			const Int32 SC_FIGHT_BEGIN = 3405;					//战斗开始通知
			const Int32 SC_FIGHT_OPERATE_FRAME = 3406;			//操作帧
			const Int32 SC_FIGHT_RESULT = 3407;					//结果通知
			const Int32 SC_FIGHT_QUIT = 3408;					//退出回复
			const Int32 SC_FIGHT_FRAME_RECORD = 3409;			//战斗帧记录请求
		}

		//3001:战斗状态请求
		class CSFightStateRequest : public NetMessage
		{
		};

		//3002:选择角色请求
		class CSFightSelectRoleRequest : public NetMessage
		{
		public:
			CSFightSelectRoleRequest();
			virtual int Unpack(Byte *buffer, int index);

			Int32 RoleConfigID;						//角色配置ID
			Byte Confirm;							//是否确定(0:预选 1:确定)
		};

		//3004:加载进度上报
		class CSFightLoadingProgressRequest : public NetMessage
		{
		public:
			CSFightLoadingProgressRequest();
			virtual int Unpack(Byte *buffer, int index);

			Int16 Progress;							//进度[0-1000]
			Byte Completed;							//是否完成
		};

		//3006:操作请求
		class CSFightOperateRequest : public NetMessageBytes
		{
		};

		//3007:结果请求
		class CSFightResultRequest : public NetMessage
		{
		public:
			CSFightResultRequest();
			virtual int Unpack(Byte *buffer, int index);

			Byte WinCamp;							//胜利的阵营(1:红色 2:蓝色)
		};

		//3008:退出请求
		class CSFightQuitRequest : public NetMessage
		{
		};

		//3009:战斗帧记录请求
		class CSFightFrameRecordRequest : public NetMessage
		{
		public:
			CSFightFrameRecordRequest();
			virtual int Unpack(Byte *buffer, int index);

			Int32 StartIndex;						//起始帧索引
			Int32 EndIndex;							//结束帧索引(不包含)
		};

		//匹配玩家信息
		class FightPlayerInfo : public NetMessage
		{
		public:
			FightPlayerInfo();
			virtual int Pack(Byte *buffer, int index);

			Int32 UserID;							//用户ID
			string NickName;						//昵称
			SByte RoleID;							//角色ID
			Int32 RoleConfigID;						//角色配置ID
			Byte Confirm;							//是否确定(0:预选 1:确定)
		};

		//3401:战斗状态通知
		class SCFightStateResponse : public NetMessage
		{
		public:
			SCFightStateResponse();
			virtual int Pack(Byte *buffer, int index);

			Byte State;								//战斗阶段(0:未参与战斗 1:选角色 2:战斗加载 3:战斗中 4:提前退出)
			Int32 PlayerCount;						//玩家数量
			vector<FightPlayerInfo> PlayerList;		//玩家列表
			Int32 Param;							//参数(与State相关 1:选角倒计时秒 3:当前已经进行到的帧数)
			UInt32 RandSeed;						//战斗随机种子(State等于3有效)
		};

		//3402:选择角色通知
		class SCFightSelectRoleNotify : public NetMessage
		{
		public:
			SCFightSelectRoleNotify();
			virtual int Pack(Byte *buffer, int index);

			Int32 UserID;							//用户ID
			Int32 RoleConfigID;						//角色配置ID
			Byte Confirm;							//是否确定(0:预选 1:确定)
		};

		//3403:选择角色结束通知
		class SCFightSelectRoleEndNotify : public NetMessage
		{
		};

		//3404:加载进度通知
		class SCFightLoadingProgressNotify : public NetMessage
		{
		public:
			SCFightLoadingProgressNotify();
			virtual int Pack(Byte *buffer, int index);

			Int32 UserID;							//用户ID
			Int16 Progress;							//进度[0-1000]
			Byte Completed;							//是否完成
		};

		//3405:战斗开始通知
		class SCFightBeginNotify : public NetMessage
		{
		public:
			SCFightBeginNotify();
			virtual int Pack(Byte *buffer, int index);

			UInt32 RandSeed;						//战斗随机种子
			Int64 StartTime;						//倒计时开始时间
			Int32 LastTime;							//广播开始倒计时
		};

		//3406:操作帧
		class SCFightOperateFrameNotify : public NetMessageBytes
		{
		};

		//3407:结果通知
		class SCFightResultNotify : public NetMessage
		{
		public:
			SCFightResultNotify();
			virtual int Pack(Byte *buffer, int index);

			Byte WinCamp;							//胜利的阵营(1:红色 2:蓝色)
		};

		//3408:退出回复
		class SCFightQuitResponse : public NetMessage
		{
		};

		//3409:战斗帧记录请求
		class SCFightFrameRecordResponse : public NetMessageBytes
		{
		};
	}
}

#endif
